Repository navigation
feat: the TOML reader accepts TOML 1.1 inline tables written over several lines - #929
Merged
Sunrisepeak merged 2 commits intoNov 16, 2026
Conversation
…eral lines
mcpp.libs.toml read an inline table only when it was written on one line:
a newline, a comment or a comma after the last pair inside the braces was
refused with `expected key`. TOML 1.1.0 allows all three, and the provider
example in docs/35 already writes `runner = { ... }` over three lines, which
mcpp could not read.
read_inline_table now skips newlines and comments between the braces and the
pairs and accepts a comma after the last pair. A pair stays on one line, an
empty element (`{ , }`, `{ a = 1,, }`) is still refused, and a table that
never closes is reported at its `{` as `unterminated inline table`. Every
document that parsed before parses into the same tree.
Two text editors meet the new form:
- upsert_dependency_text (`mcpp add`, template self-dependency injection)
replaced an existing entry by its first line only, so its own re-parse
refused the result. It now replaces the whole value.
- `mcpp remove` erased the first line only and wrote the file without a
re-parse, leaving the rest of the value as a corrupt manifest. It now erases
the whole value.
Both use one helper, mcpp::manifest::assignment_end, which finds the newline
after a value by counting brackets outside strings and comments.
`mcpp index pin` and `unpin` still edit only an entry on one line; their
refusal of a multi-line one now says so instead of calling it malformed.
Docs: docs/04 states the TOML dialect, docs/09 the pin/unpin boundary, in
English and Chinese.
Tests: Toml.AnInlineTableSpansLines, Toml.AnInlineTableKeepsEachPairOnOneLine,
ManifestEditor.ReplacesAnEntryWrittenOverSeveralLines,
ManifestEditor.AnAssignmentEndsWhereItsValueCloses, and a multi-line entry in
e2e 23_remove_update.sh.
Closes mcpp-community#928.
main replaced the shell end-to-end scripts with C++ cases, so the multi-line remove check moves from 23_remove_update.sh into the '23 remove update' case of tests/e2e/deps/path.cpp.
Sunrisepeak
added a commit
that referenced
this pull request
Nov 16, 2026
Sunrisepeak
added a commit
that referenced
this pull request
Nov 16, 2026
… the index's platform column, N48 (#944) * design record: N43-N47 (UEFI Shell arguments, the DOS first stack, N9 and dist-web 0.20.0, a run's input files, the UEFI payload disk) and the layers of further target rows * design record: ecosystem gap supplement, part 2 -- the roles of a file, a run's inputs, the manifest's writing and part 1's remaining items (for review) * Design record: part 2 revised after a multi-angle review (v2) * Design record: part 2 v3, the decided points and a two-way review against the verification project * Design record: part 2 v4, N48, the FreeBSD runner, setup-mcpp, and the implementation plan with its review * Design record: part 2 v4, mark the settled sections * Design record: part 2 v5, the plan is settled and new repositories go through their first pull request * N48: a row's fixed executable suffix ends a templated name A row states exe-suffix-fixed = true when its executable suffix is part of loading its programs. A name template (a build program's artifact_name, link.exe) then decides what precedes the suffix, and the name ends in it once: artifact_name("exe", "{name}") gives app.js beside app.wasm on wasm32-emscripten, where it gave a bare app, and {name}.js gives app.js, not app.js.js. The built-in wasm32-emscripten row states it; a platform states it for its own rows. The key is read by the built-in table's generator and by the platform reader alike. Spec: targets-and-providers v1.4 (2.1). Test: e2e web 1101. * deploy: an entry is a path or a table; globs, name, and stale copies removed [runtime] deploy takes a string, which is { from = <string> }, or a { from, to, name } table, in mcpp.toml and in descriptors. from may be a glob of the engine's one dialect; a match lands under to at its path below the glob's fixed directory (a literal path's is its parent, so every existing entry lands where it did). name renames the one match. A glob matching nothing and a name over several files are refused, naming the package and the entry; a literal path may still be generated by the build. deploy_files globs expand by the same rule. The expansion runs when the build is planned and enters the graph; placed.list beside build.ninja remembers the destinations, and a copy the new graph no longer places is removed from beside the program. SPEC-004 §15 (v1.20); docs/04 in both languages; unit tests for the readers and expand_deploy_entry; e2e runtime/deploy 1102. * license_files: every pack stages each package's license files [package] license_files names a package's license and notice files as globs relative to its root; a descriptor writes the same key in its mcpp segment. Unset, the engine's default {LICENSE,LICENCE,COPYING, NOTICE}* applies. The build plan records each package of the graph with its patterns, and every pack, in every mode, stages them under share/licenses/<package>/ with the role metadata: static libraries are covered as shared ones are. A package for which nothing is found is named in the report; a declared glob that selects nothing is warned about. This replaces collect_licenses, which ran only in self-contained packs, under seven fixed names, and said nothing when it found none. That mode still looks for the default files beside the shared objects it bundles that no package declares, and names those without. SPEC-004 §15.6-7, SPEC-014 §4.5.1 (v2.6); docs/04 and docs/10 in both languages; unit tests for both readers; e2e pack/modes 1103. * run files: mcpp run --file, [test] files, and the run's working directory mcpp run --file FROM[=TO] (repeatable, dirun's spelling) and [test] files (the deploy entry grammar, with [target.'<sel>'.test] files) name the files a run finds in its working directory. With them, the program runs in run/<id>/ of the build tree, into which they are copied (never linked): mcpp run waits for the program and removes the directory; a test program's directory is shared by its split parts, removed when it passes, kept and named when it fails. The directory is prepared before the launch is composed, so --print-launch and a test's launch name a directory that holds the files. Without run files nothing changes. A runner receives them as run_files in MCPP_RUN_CLOSURE (schema 2) and in MCPP_RUNTIME_FILES beside the runtime files, which is now derived as the union: where the program has a file system of its own, its directory is its working directory. Both fast paths decline when run files are named. SPEC-002 §6.2 and §6.2.1 (v1.9), SPEC-017 B1.6 and B5 (2.4); docs/04, docs/08 and docs/09 in both languages; unit test for [test] files; e2e run/contract 1104 and test/selection 1105; 927 reads schema 2. * platform: a row the built-in table has no platform for takes the one the index lists A platform package's index entry lists the rows it serves (`platform_rows = { "x86_64-uefi", ... }`). Step 5 of the platform choice, the target table's platform column, consults the index when the built-in table has no answer: a row the engine does not know, a row a platform defines, or a `planned` row. The package is selected as a series (`<ns>.<name>@*`), so its release is chosen, locked and updated as any platform series is, and the report names the source `index`. - The project's own indices ([indices], .mcpp/) rank before the shared ones; within one rank two claims are named and the first is taken. - A row the table answers is unchanged, and every statement of the project, the machine, the environment and the command line still comes first. - The entries are scanned once per command, and only for such a row (about 0.05 s for the whole refusal over ~400 entries). - mcpp 2026.11.16.1 reads an entry carrying the field and ignores it (measured with openkal-platform's entry). Tests: e2e 1106 (unknown row, planned row, the project first, two claims, no column), PlatformSelect unit. SPEC-013 v1.11 (§3.1, §14, criterion 16), docs/35 en/zh; the openkal-platform example uses multi-line inline tables. * docs: multi-line inline tables are 2026.11.17.1+, and the changelog says so (#929) * Design record: part 2 v6, measurements and the decisions taken while implementing * 2026.11.17.1: the version and the changelog's section * Design record: part 2 is active; the .agents/docs index; the dirun test's cause * platform: a manifest's [[platform.system]] reaches the platform reader * tests: 1104's runner is declared for the host's own row; 1105 states its host file for Windows too and names its copy apart from the original on case-insensitive file systems; the design record states the dirun test's cause as found * platform: the index's column is scanned with no lock held, so a leg that holds the home's lock does not wait on another; the scan is cached per set of roots * skills: a pull request that needs the full CI is labelled ci:full before its push * platform: a row the table holds with no platform and no built-in provider of that row here (x86_64-freebsd) takes the index's platform rather than a sibling row; table_answers decides it in both places * Design record: the timeouts' cause is open; the fourth kind of row the index answers; illumos and OpenBSD findings * SPEC-013 §14: which rows an entry's platform_rows lists, and that a host's own row is never among them * test: a package's programs are planned with its dev-dependencies, as its tests are, so a shared module is not compiled again over itself; a failure naming no step shows ninja's last lines (#945) * test: the programs a test runs request no [test] features (#941 stands); the testing chapter says the programs are planned with the dev-dependencies * tests: 1104 takes the host's row from its build directory (mcpp has no --print-target) * Design record: the timeouts did not recur with the scan's lock released; i686-openkal is the planned row a set's legs scan for * run files: the run's directory is removed by the interrupt watcher too, so a request that ends mcpp leaves no run-<pid>-<n> behind * Bases: a version directory with a manifest is the package root; a base's C++ library leaves the link when another package supplies the C++ layer An OpenBSD sysroot holds only usr/ beside its mcpp.toml, and the payload resolution descended into usr/ as into an extracted tarball (payload_root, unit PmPayloadRoot). A NetBSD program built with libc++ from source (the provider's layers) still linked the base's libstdc++ through the base's ldflags (SPEC-002 §2.5, e2e 1108). * Design record: the OpenBSD package root, the image profile, and NetBSD's import std through libc++ from source * A cfg selector names the platform of a row only that platform defines The early selection read only tables keyed by the triple, so [target.'cfg(any(os = "netbsd", os = "openbsd"))'] platform was refused as an unknown target. Until a row defines the triple, a selector is answered by its words, <arch>-<os>[-<env>] (SPEC-013 §3.1, e2e 1040). * runner = true | false: an override's consent alone, { enabled = ... }; the refusal names it and the platform-wide selector A runner's statement (a platform's, a provider's) states its command; an override table may enable or disable it by a boolean (e2e 1092 G, H). * Revert the programs planned with the dev-dependencies (#945): a dev-dependency's objects reached the programs' link CI showed the change wrong: a dev-dependency that supplies main (gtest_main) was linked into the program (duplicate symbol main, e2e graph/78), and the programs' plan no longer matched mcpp build's, so the test fast path declined (e2e 1069). The programs are planned as mcpp build plans them, as before. The diagnostic for a failure that names no step stays. * Docs: runner = true | false, and a runner's statement and its consent as two layers (SPEC-013 §10, docs/41, docs/04) * Matrix: i686-linux-musl and i686-openkal are named a platform by the index's column (measured on all four hosts) * A test plan that configures a package otherwise than mcpp build builds in a directory of its own; a build program's unchanged output keeps its time (#945) The tests' configuration axis (#test=) enters the fingerprint when the tests ask a package for features ([test] features, or a dev-dependency entry that asks a package the manifest also depends on). One directory held both configurations, whose interfaces and objects are named by module and package, and each plan compiled over the other. A build program rerun when its cached answer was another configuration's rewrote its generated source with a new time. e2e 1107: one compile per configuration, none again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mcpp.libs.tomlread an inline table only when it was written on one line. A newline, a comment or a comma after the last pair inside the braces was refused withexpected key. TOML 1.1.0 allows all three, and the provider example indocs/35-platforms.mdalready writesrunner = { ... }over three lines, which mcpp could not read. The released 2026.11.12.1 refusescmdline = { version = "0.0.1",⏎ features = [] }withmcpp.toml:6:31: error: expected key.read_inline_tablenow skips newlines and comments between the braces and the pairs, and accepts a comma after the last pair. A pair stays on one line (key = value, as TOML 1.1 requires). An empty element ({ , },{ a = 1,, }) is still refused. A table that never closes is reported at its{asunterminated inline table.Two text editors meet the new form, and both now handle the whole value:
upsert_dependency_text(mcpp add, template self-dependency injection) replaced an existing entry by its first line only. Its own re-parse then refused the result (dependency edit produced invalid manifest).mcpp removeerased the first line only and wrote the file without a re-parse. That left the rest of the value behind as a corrupt manifest.Both use one helper,
mcpp::manifest::assignment_end. It finds the newline after a value by counting brackets outside strings and comments.mcpp index pinandunpinstill edit only an[indices]entry written on one line. They already refused a multi-line one without writing anything, but called it "malformed"; the refusal now states the real cause.docs/04states the TOML dialect anddocs/09states the pin/unpin boundary, in English and Chinese.Closes #928.
Criteria
Toml.AnInlineTableSpansLinescovers newlines, comments, a trailing comma, a nested table with trailing commas, a multi-line array inside the table,{⏎}, and a key after the table.Toml.AnInlineTableKeepsEachPairOnOneLinecovers what stays refused: a pair split before or after=, two pairs without a comma,,,,{ , }, and the position and text ofunterminated inline table. On macOS arm64 I builtmodules/libswithtests/unit/test_toml.cppusing the released 2026.11.12.1. Both cases fail without the change (expected key, and"expected key" == "unterminated inline table") and pass with it; all 20 cases pass.ManifestEditor.ReplacesAnEntryWrittenOverSeveralLinesreplaces a multi-line entry that holds a}in a comment and a]in a string.ManifestEditor.AnAssignmentEndsWhereItsValueClosespins the helper. On the same host I built themodules/manifestpackage alone with these two tests, the two existingManifestEditortests andtests/unit/test_toml_serialize.cpp(includingRepositoryManifestsRoundTrip). All pass. Without the change, the editor case fails withdependency edit produced invalid manifest: mcpp.toml:7:23: error: expected key.tests/e2e/23_remove_update.shnow seeds a multi-linebaz = { ... }and removes it. With the released 2026.11.12.1 it fails: the manifest keeps the table's last three lines under[dependencies]. I did not build a full mcpp binary on this host, so the passing run of this script, and the compile ofsrc/pm/commands.cppmandsrc/pm/index_management.cppm, are left to CI. I checked themcpp removeerase logic separately in a scratch test that copies its lambda overassignment_end: on the script's manifest it leavesfooandbarintact.check_docs_style.sh,check_docs_structure.sh,check_version_pins.sh,check_manifest_key_classes.py,check_narrow_conversions.sh,check_include_regions.shandcheck_workflow_assertions.pypass.Intersections
serializewrites a document that reads back into the same tree (it writes inline tables on one line)TomlSerialize.*, includingRepositoryManifestsRoundTripmcpp addedits one entry and re-parses its resultManifestEditor.ReplacesAnEntryWrittenOverSeveralLinesmcpp removeerases one entry and leaves the others23_remove_update.sh(bazremoved whole,barkept)mcpp index pin/unpinedit an[indices]entry in place#inside a string is not a commentAnInlineTableSpansLines("{}"and"--"values),AnAssignmentEndsWhereItsValueClosesCompatibility
Every file that parsed before parses into the same tree. Files with an inline table over several lines, a comment inside one, or a trailing comma were refused before and now load. Only one error message changes for a file that was refused before: an inline table that never closes is reported at its
{asunterminated inline tableinstead ofexpected key. No output, default or cache key changes.Checks before merging
bash .github/tools/check_docs_style.sh,check_docs_structure.shandcheck_version_pins.shpass.python3 .github/tools/check_workflow_assertions.pypasses (a step asserts what its name says).git log origin/main..HEAD -i --grep='Co-Authored-By'prints nothing.compose one from the branch's commits. Suggested subject:
feat: the TOML reader accepts TOML 1.1 inline tables written over several lines.